﻿$(document).ready(function () {

    $("#divko").text("hello world");

    $("#div1").click(function () {
        $("#divko").text("klikol som daco");

        
    });

});

///////////copy

                var treeView;
                var textBox;
                
                function pageLoad()
                {
//                    treeView = $find ("<%= RadTreeView1.ClientID %>");
//                    textBox = $find("<%= RadTextBoxNode.ClientID %>");
                }
                
                function addNode() {
                    var parent = $(this).parent("*:first");

                    var nodeText = textBox.get_value();
                    if (!nodeText)
                    {
                        alert("Please specify the text for the new node.");
                        return false;
                    }
                    
                    treeView.trackChanges();
                    
                    //Instantiate a new client node
                    var node = new Telerik.Web.UI.RadTreeNode();
                    //Set its text
                    node.set_text(nodeText);
                    //Add the new node as the child of the selected node or the treeview if no node is selected
                    var parent = treeView.get_selectedNode() || treeView;
                    parent.get_nodes().add(node);
                    //Expand the parent if it is not the treeview
                    if (parent != treeView && !parent.get_expanded())
                        parent.set_expanded(true);
                    
                    treeView.commitChanges();
                    return false;
                }
                
                function deleteNode()
                {
                    var allNodes = treeView.get_allNodes();
                    if (allNodes.length < 1)
                    {
                        alert("The treeview is empty.");
                        return false;
                    }
                    
                    var selectedNode = treeView.get_selectedNode();
                    if (!selectedNode)
                    {
                        alert("You need to select a node first.");
                        return false;
                    }
                    
                    if (allNodes.length == 1)
                    {
                        if (!confirm("This is the last node in the treeview. Are you sure you want to delete it?"))
                            return false;
                    }
                    
                    treeView.trackChanges();
                    
                    var parent = selectedNode.get_parent();
                    parent.get_nodes().remove(selectedNode);
                    
                    treeView.commitChanges();
                    
                    return false;
                }
                
                function disableNode()
                {
                    var selectedNode = treeView.get_selectedNode();
                    if (!selectedNode)
                    {
                        alert("You need to select a node first.");
                        return false;
                    }
                    
                    treeView.trackChanges();
                    
                    selectedNode.disable();
                    
                    treeView.commitChanges();
                    
                    return false;
                }
                
                function checkNode()
                {
                    var selectedNode = treeView.get_selectedNode();
                    if (!selectedNode)
                    {
                        alert("You need to select a node first.");
                        return false;
                    }
                    
                    selectedNode.set_checked(!selectedNode.get_checked());
                    
                    return false;
                }
                
                function toggleNode()
                {
                    var selectedNode = treeView.get_selectedNode();
                    if (!selectedNode)
                    {
                        alert("You need to select a node first.");
                        return false;
                    }
                    
                    selectedNode.set_expanded(!selectedNode.get_expanded());
                    
                    return false;
                }
                
                function enableAllNodes()
                {
                    var allNodes = treeView.get_allNodes();
                    for (var i = 0; i < allNodes.length; i++)
                    {
                        allNodes[i].enable();
                    }
                    return false;
                }
